﻿function submitForm() {
    var theForm = document.forms[0];
    if (theForm.email.value != '' && theForm.password.value != '') {
        if (parent != null) {
            theForm.target = "_parent";
            theForm.password.value = getAES(theForm.password.value);
            theForm.submit();
        }
    }
}

function getAES(string) {
    var key = 'zxmd2013qazwsx12';
    var iv = 'qazwsx12zxmd2013';
    var encrypted = getAesString(string, key, iv);
    return encrypted;
}

function getAesString(data, key, iv) {
    var key = CryptoJS.enc.Utf8.parse(key);
    var iv = CryptoJS.enc.Utf8.parse(iv);
    var encrypted = CryptoJS.AES.encrypt(data, key, {
        iv: iv,
        mode: CryptoJS.mode.CBC,
        padding: CryptoJS.pad.Pkcs7
    });
    return encrypted.toString();
}